package day01;

public class demo8 {
    public static void main(String[] args) {
                int a = 1234;
                int b = reverseNumber(a);
                System.out.println("反转后的数为: " + b);
            }
            private static int reverseNumber(int num) {
                int reversed = 0;
                while (num != 0) {
                    int digit = num % 10;
                    reversed = reversed * 10 + digit;
                    num /= 10;
                }
                return reversed;
            }


        }